<?php
/**
 * Created by PhpStorm.
 * User: xutao
 * Date: 2018/8/2
 * Time: 14:53
 */
namespace app\common\model;
use think\Model;

class LookModel extends Model{
    protected $table = 'think_look';
//    protected $autoWriteTimestamp = true;   // 开启自动写入时间戳
    protected $autoWriteTimestamp = 'datetime';
    public function getCreateTimeAttr($time)
    {
        return $time;
    }
    public function getUpdateTimeAttr($time)
    {
        return $time;
    }

    public static function create_data($data){
        $lookmodel = new LookModel();
        $re = $lookmodel->allowField(true)->save($data);
        if($re){
            return $lookmodel->id;
        }else{
            return false;
        }
    }
//    修改器
    public function getStateAttr($value){
        $data = [
            0=>'未审核',
            1=>'已通过',
            2=>'未通过'
        ];
        return $data[$value];
    }



}